<template>
  <div class="pagetwo">
    <h3>pagetwo</h3>
    <div class="funcPractise">
      <h6>函数理解</h6>
      <span @click="seeIt">输出</span>
      <div class="mockDemo">
        <h5>mock的使用</h5>
        <button @click="getData">请求mock数据</button>
        <p><em>姓名：</em>{{resData.name}}</p>
        <p><em>年龄：</em>{{resData.age}}</p>
        <p><em>身高：</em>{{resData.height}}</p>
        <p><em>体重：</em>{{resData.weight}}</p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'PageTwo',
  data () {
    return {
      resData: ''
    }
  },
  methods: {
    seeIt () {
      var funcs = []
      for (var i = 0; i < 10; i++) {
        funcs.push(function () { console.log(i) })
      }
      funcs.forEach(function (func) {
        func()
      })
    },
    getData () {
      this.axios.post('/firstMockData').then(res => {
        this.resData = res.data
        console.log(res.data)
      })
    }
  }
}
</script>

<style scoped>
  span {background-color: #999; color: #fff;}
</style>
